#include<mxml.h>  
#include<string.h>  
#include<stdio.h>  
#include<stdlib.h>  
  
int main()  
{  
    FILE *fp;  
    mxml_node_t *tree;  
#if 0  
    mxml_node_t *node;  
    fp = fopen("debug_settings.xml", "r");  
    tree = mxmlLoadFile(NULL, fp,MXML_TEXT_CALLBACK);  
    fclose(fp);  
  
    node = mxmlFindElement(tree, tree, "note",NULL, NULL,MXML_DESCEND);  
    printf("year:%s \n",mxmlElementGetAttr(node,"year"));  
    printf("date:%s \n",mxmlElementGetAttr(node,"date"));  
    printf("month:%s \n",mxmlElementGetAttr(node,"month"));  
  
  
    mxml_node_t *id,*password;  
    id = mxmlFindElement(node, tree, "id",NULL, NULL,MXML_DESCEND);  
    printf("[%s]\n",id->child->value.text.string);  
  
    password = mxmlFindElement(node, tree, "password",NULL, NULL,MXML_DESCEND);  
    printf("[%s]\n",password->child->value.text.string);  
#else

    fp = fopen("SampleApp.xml", "r");  
    tree = mxmlLoadFile(NULL, fp,MXML_TEXT_CALLBACK);  
    fclose(fp);

    mxml_node_t *project;      
    project = mxmlFindElement(tree, tree, "project",NULL, NULL,MXML_DESCEND);  
     
  
    mxml_node_t *configuration;  
    configuration = mxmlFindElement(project, tree, "configuration",NULL, NULL,MXML_DESCEND);  

    mxml_node_t *name;  
    name = mxmlFindElement(configuration, tree, "name",NULL, NULL,MXML_DESCEND);  
    printf("name == [%s]\n",name->child->value.text.string); 

    mxml_node_t *outputs;  
    outputs = mxmlFindElement(configuration, tree, "outputs",NULL, NULL,MXML_DESCEND);  


    mxml_node_t *file;
    for(file = mxmlFindElement(outputs, tree, "file",NULL, NULL,MXML_DESCEND_FIRST); \
        file != NULL;\
        file = mxmlFindElement(file, tree, "file",NULL, NULL,MXML_NO_DESCEND))
        printf("url:%s\n",mxmlGetText(file,NULL));
#endif
    mxmlDelete(tree);  
    printf("success!\n");
  
    return 0 ;  
}  
